#include "sphere.h"
#include <stdio.h>
#include <GL/glut.h>

using namespace std;

Sphere::Sphere(float r, float *m)
{
    if (m)
    {
	for (int i = 0; i < 4 * 4; ++i)
	{
	    _m[i] = m[i];
	}
    }
    else
    {
	for (int i = 0; i < 4 * 4; ++i)
	{
	    _m[i] = 0.0;
	}
    }
    _m[0] = 1.0;
    _m[5] = 1.0;
    _m[10] = 1.0;
    _m[15] = 1.0;

    radius = r;
}

void Sphere::renderInLocalFrame() const
{
    glScalef(radius, radius, radius);
    glColor3ubv(color);
    glutSolidSphere(1.0f, 100, 100);
}
